import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BillMonthRecordVO, BillMonthRecordForm, BillMonthRecordQuery } from '@/api/credit/bill/record/types';

/**
 * 查询信用卡还款的月份标识记录列表
 * @param query
 * @returns {*}
 */

export const listBillMonthRecord = (query?: BillMonthRecordQuery): AxiosPromise<BillMonthRecordVO[]> => {
  return request({
    url: '/credit/billMonthRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询信用卡还款的月份标识记录详细
 * @param id
 */
export const getBillMonthRecord = (id: string | number): AxiosPromise<BillMonthRecordVO> => {
  return request({
    url: '/credit/billMonthRecord/' + id,
    method: 'get'
  });
};


/**
 * 查询信用卡还款的月份标识记录详细
 * @param id
 */
export const splitBillRecord = (id: string | number): AxiosPromise<BillMonthRecordVO> => {
  return request({
    url: '/credit/billMonthRecord/split/bill/' + id,
    method: 'get'
  });
};


/**
 * 新增信用卡还款的月份标识记录
 * @param data
 */
export const addBillMonthRecord = (data: BillMonthRecordForm) => {
  return request({
    url: '/credit/billMonthRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改信用卡还款的月份标识记录
 * @param data
 */
export const updateBillMonthRecord = (data: BillMonthRecordForm) => {
  return request({
    url: '/credit/billMonthRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除信用卡还款的月份标识记录
 * @param id
 */
export const delBillMonthRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/credit/billMonthRecord/' + id,
    method: 'delete'
  });
};
